import unittest,time
from re import search
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver import Keys


class TestA3mall:
    def setup_method(self):
       self.driver=webdriver.Firefox()
       self.driver.get('http://10.59.9.12:7001/')
       self.driver.maximize_window()
       time.sleep(3)
    def teardown_methon(self):
        time.sleep(3)
        self.driver.quit()

    def Test_A3mall_Login(self):
        # 点击登录
        self.driver.find_element(By.XPATH, '/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
        time.sleep(3)
        # 输入框输入账号
        self.driver.find_element(By.NAME, 'username').send_keys('13811033962')
        # 输入框输入密码
        self.driver.find_element(By.NAME, 'password').send_keys('123456')
        time.sleep(15)
        # 点击登录按钮
        self.driver.find_element(By.XPATH, '//*[@id="theForm"]/div[5]/a').click()
        time.sleep(6)
        # 断言,登陆成功：欢迎回来
        dy = self.driver.find_element(By.XPATH, '/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[1]').text
        print("断言：", dy)